<!DOCTYPE html>
<html>
	<head>
		<title>Converting strings to dates</title>
		<link rel="stylesheet" href="../../../codebase/webix.css" type="text/css" charset="utf-8">
		<script src="../../../codebase/webix.js" type="text/javascript" charset="utf-8"></script>

		<link rel="stylesheet" type="text/css" href="../common/samples.css">
		<script src="../common/testdata.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div class='header_comment'>Converting strings to dates</div>
		<div class='sample_comment'>Parsing dates through data scheme.</div>
		<div id="testA"></div>
		<hr>
		<div class='sample_comment'>Parsing dates through mapping.</div>
		<div id="testB"></div>
		<script type="text/javascript" charset="utf-8">
		webix.ready(function(){

			var xml_format = webix.Date.strToDate("%Y-%m-%d");
			grida = webix.ui({
				container:"testA",
				view:"datatable",
				scheme:{
					$init:function(obj){
						obj.start = xml_format(obj.start);
					}
				},
				columns:[
					{ id:"text",  header:"Point" },
					{ id:"start", header:"Date", sort:"date", format:webix.i18n.dateFormatStr}
				],
				
				autoheight:true,
				autowidth:true,
				data:[
					{ text:"Joint 2", start:"2011-2-14" },
					{ text:"Finish", start:"2012,12,12" },
					{ text:"Start", start:"1988-2-29" },
					{ text:"Joint 1", start:"2010-11-30" }
				]
			});

			gridb = webix.ui({
				container:"testB",
				view:"datatable",
				columns:[
					{ id:"text",  header:"Point" },
					{ map:"(date)#start#", header:"Date", sort:"date", format:webix.i18n.dateFormatStr}
				],
				
				autoheight:true,
				autowidth:true,
				data:[
					{ text:"Joint 2", start:"2011-2-14" },
					{ text:"Finish", start:"2012,12,12" },
					{ text:"Start", start:"1988-2-29" },
					{ text:"Joint 1", start:"2010-11-30" }
				]
			});


		});
		</script>
	</body>
</html>